<%@ page pageEncoding="ISO-8859-1" contentType="text/html; charset=ISO-8859-1" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<script type="text/javascript" src="scripts/defscripts.js"></script>
<fmt:setBundle basename="MessageResources"/>

<form name="elementForm" method="post" action="${param['formAction']}">
	<table border="0" cellpadding="1" align="center">
		<tr>
			<td align="right"><fmt:message key="disease.name"/>:</td>
			<td><input name="element.name" type="text" size="30" value="${element.name}"></td>
		</tr>
		<tr>
			<td align="right" valign="top"><fmt:message key="disease.description"/>:</td>
			<td><textarea name="element.description" rows="5" cols="30">${element.description}</textarea></td>
		</tr>
		<tr>
			<td align="right"><fmt:message key="disease.source"/>:</td>
			<td><input name="element.source" type="text" size="30" value="${element.source}"></td>
		</tr>
		<tr>
			<td align="right"><fmt:message key="disease.origin"/>:</td>
			<td><input name="element.origin" type="text" size="30" value="${element.origin}"></td>
		</tr>
		<tr>
			<td align="right" valign="top"><fmt:message key="disease.symptoms"/>:</td>
			<td>
				<input name="comboListSize" type="hidden" id="comboListSize" value="0">
				<select name="sourceCombo" id="sourceCombo" style="display:none">
					<option value="null"><fmt:message key="disease.symptom.select"/>
					<c:forEach items="${symptomList}" var="eachSymptom">
						<option value="${eachSymptom.id}">${eachSymptom.name} --- ${eachSymptom.description}
					</c:forEach>
				</select>
				<div id="symptomsComboList"></div>
				<input name="addSymptomButton" type="button" value="<fmt:message key='disease.register.form.addSymptomButton.label'/>" onclick="addCombo('symptomsComboList','symptomsCombo')">
				<script type="text/javascript">
					for (i = 0; i < 5; i++) document.elementForm.addSymptomButton.click();
					<c:forEach items="${element.symptoms}" var="eachSymptom" varStatus="eachId">
						if (${eachId.count - 1} >= document.elementForm.comboListSize.value) document.elementForm.addSymptomButton.click();
						document.elementForm.symptomsCombo${eachId.count - 1}.value = ${eachSymptom.id};
					</c:forEach>
				</script>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input name="submit" type="submit" value="<fmt:message key='element.form.submit.label'/>">
				<input name="clear" type="reset" value="<fmt:message key='element.form.clear.label'/>">
				<input name="back" type="button" value="<fmt:message key='element.form.back.label'/>" onclick="location.href='${backPage}'">
			</td>
		</tr>
	</table>
</form>
